import { Api } from './../../../providers/api-service';
import { SettingFankuiPage } from './fankui/setting-fankui';
import { JPushService } from 'ionic2-jpush';
import { SettingAccountPage } from './account/setting-account';
import { Storage } from '@ionic/storage/dist';
import { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
import { LoginPage } from '../../login/login';
import { SettingAboutPage } from './about/setting-about';

@Component({
  selector: 'page-setting',
  templateUrl: 'setting.html',
})
export class UserSettingPage {

  checked = true;
  constructor(
    public navCtrl: NavController,
    public storage: Storage,
    public jPushService: JPushService,
    public navParams: NavParams,
    public api: Api
  ) {

  }

  btns(key) {
    switch (key) {
      case 'about': //关于我们
        this.navCtrl.push(SettingAboutPage);
        break;
      case "account"://账号设置
        this.navCtrl.push(SettingAccountPage);
        break;
      case "fankui"://意见反馈与帮助
        this.navCtrl.push(SettingFankuiPage);
        break;
      case 'xieyi'://用户协议
        this.navCtrl.push(SettingFankuiPage);
        break;
    }

  }

  /**
   * 退出登录
   */
  unLogin() {
    localStorage.removeItem("User");
    localStorage.removeItem("Ticket");
    this.storage.set("firstIn", 0);
    this.navCtrl.push(LoginPage);
  }

  /**
   * wifi设置
   */
  setWifi(e) {
    //console.log("设置");
  }


  /**
   * 是否启动推送
   */
  setPush(e) {
    //console.log(e);
    this.jPushService.stopPush();
  }
}
